<template>
	<view class="ys">
		<view class="form">
			<uni-section title="情况内容" type="line">
				<view class="inputbox">
					<uni-easyinput type="textarea" v-model="content" trim placeholder="情况内容	"
						clearSize="20"></uni-easyinput>
				</view>
			</uni-section>
			<uni-section title="上传图片" type="line">
				<view class="inputbox">
					<fjjImages :pageImgList="imglist" @getimg="getimg" :type="'getimg'" :imgCount="5">
					</fjjImages>
				</view>
			</uni-section>
		</view>

		<button class="btn" @click="subWatch" :loading="loading" :disabled="loading">提交</button>
	</view>
</template>

<script>
	import {
		addNews
	} from "@/api/staff.js"
	import fjjImages from '@/components/fjj-images/fjj-images.vue'
	export default {
		data() {
			return {
				order_id: '',
				orderRange: [],
				orderList: [],
				content: '',
				loading: false,
				staffRange: [],
				staff_id: '',
				imglist: [],
				imgs: []
			}
		},
		components: {
			fjjImages,
		},
		onLoad() {},
		methods: {
			getimg(e) {
				this.imgs = e
			},
			subWatch() {
				let that = this
				if (this.content == '') {
					return uni.$showMsg('请输入内容')
				}
				that.loading = true
				addNews({
					images: this.imgs,
					content: this.content
				}).then(res => {
					uni.$showMsg(res.msg)
					if (res.code == 0) {
						setTimeout(() => {
							uni.navigateBack()
						}, 1000)
					} else {
						that.loading = false
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.ys {
		.inputbox {
			width: 96%;
			margin: 0px auto;

			image {
				width: 60px;
				height: 60px;
				margin-left: 10px;
			}
		}

		.form {
			padding-bottom: 15px;
			background: #fff;
		}

		.btn {
			button {
				color: #fff;
				font-size: 16px;
				letter-spacing: 1px;
				margin: 30px auto;
				width: 96%;
			}
		}
	}
</style>